<?php


namespace app\middleware;

use think\facade\Request;
use think\facade\View;
use app\model\WorkerRecords;
class ControllerBak
{
    public function handle($request, \Closure $next)
    {
        $controller = Request::controller();
        if($controller == 'WorkerRecords')
        {

            $company = (new \app\model\Company)->order(['sort'=>'asc','id'=>'desc'])->select();
            View::assign('company',$company);
            $worker_type = (new \app\model\WorkerType)->order(['sort'=>'asc','id'=>'desc'])->select();
            View::assign('worker_type',$worker_type);
            $depart = (new \app\model\Depart)->order(['sort'=>'asc','id'=>'desc'])->select();
            View::assign('depart',$depart);
            $worker_type = (new \app\model\WorkerType)->order(['sort'=>'asc','id'=>'desc'])->select();
            View::assign('worker_type',$worker_type);;
        }

        return $next($request);
    }
}